# The transpiling part is the core part, it consists of multiple rounds, controlled by the controller.
# In each round, the controller do the folloing things:
# 1. collect data from the previous round.
# 2. select:
#    1. all done, exit.
#    2. target C code slice, auxiliary data
# 2. compose the prompt.
# 3. get result from llm.
# 4. process the result.

# Plan:
# - collect data:
#   - compilation result
#   - dependencies of code slices
#   - decl types of code slices:
#       - is Macro
#       - classes/structs with its member functions
# - select:
#   - if previous compliation failed:
#       - keep the previous target code slice, auxiliary
#       - replace the compilation result with the new one
#   - if previous compliation succeed:
#        - map the C code slice to Rust code slice.
#        - append previous result to the Rust pool.
#        - Select the next target code slice
#        - find out mapped rust code of dependencies
#   - if no more target code slice, exit.
# - compose the prompt: every kind of auxilary data have its own prompt template, just put them together.
# - invoke DeepSeek API
# - process result:
#   - extract code from answer
#   - merge with the rust pool and a stub main()
#   - compile
